package com.ruoyi.deeplearn.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.deeplearn.mapper.DeepModelTrainMapper;
import com.ruoyi.deeplearn.domain.DeepModelTrain;
import com.ruoyi.deeplearn.service.IDeepModelTrainService;

/**
 * 模型训练配置Service业务层处理
 *
 * @author rww
 * @date 2024-09-09
 */
@Service
public class DeepModelTrainServiceImpl implements IDeepModelTrainService
{
    @Autowired
    private DeepModelTrainMapper deepModelTrainMapper;

    /**
     * 查询模型训练配置
     *
     * @param id 模型训练配置主键
     * @return 模型训练配置
     */
    @Override
    public DeepModelTrain selectDeepModelTrainById(Long id)
    {
        return deepModelTrainMapper.selectDeepModelTrainById(id);
    }

    /**
     * 查询模型训练配置列表
     *
     * @param deepModelTrain 模型训练配置
     * @return 模型训练配置
     */
    @Override
    public List<DeepModelTrain> selectDeepModelTrainList(DeepModelTrain deepModelTrain)
    {
        return deepModelTrainMapper.selectDeepModelTrainList(deepModelTrain);
    }

    /**
     * 新增模型训练配置
     *
     * @param deepModelTrain 模型训练配置
     * @return 结果
     */
    @Override
    public int insertDeepModelTrain(DeepModelTrain deepModelTrain)
    {
        deepModelTrain.setId(IdUtil.getSnowflakeNextId());
        deepModelTrain.setCreateTime(DateUtils.getNowDate());
        return deepModelTrainMapper.insertDeepModelTrain(deepModelTrain);
    }

    /**
     * 修改模型训练配置
     *
     * @param deepModelTrain 模型训练配置
     * @return 结果
     */
    @Override
    public int updateDeepModelTrain(DeepModelTrain deepModelTrain)
    {
        deepModelTrain.setUpdateTime(DateUtils.getNowDate());
        return deepModelTrainMapper.updateDeepModelTrain(deepModelTrain);
    }

    /**
     * 批量删除模型训练配置
     *
     * @param ids 需要删除的模型训练配置主键
     * @return 结果
     */
    @Override
    public int deleteDeepModelTrainByIds(Long[] ids)
    {
        return deepModelTrainMapper.deleteDeepModelTrainByIds(ids);
    }

    /**
     * 删除模型训练配置信息
     *
     * @param id 模型训练配置主键
     * @return 结果
     */
    @Override
    public int deleteDeepModelTrainById(Long id)
    {
        return deepModelTrainMapper.deleteDeepModelTrainById(id);
    }

    @Override
    public DeepModelTrain selectDeepModelTrainByIdModelId(Long modelId) {
        return deepModelTrainMapper.selectDeepModelTrainByIdModelId(modelId);
    }
}
